<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>重复请求问题</title>
</head>
<body>
    <button id="btn1">点击发送</button>
    <script>
       let btn1 = document.getElementById('btn1')
       let xhr = null
       btn1.onclick = function () {
           if (xhr){
               xhr.abort()
           }
           xhr = new XMLHttpRequest()
           xhr.open('GET','http://127.0.0.1:8000/repeat')
           xhr.send()
           xhr.onreadystatechange = function (){

           }
       }
    </script>
</body>
</html>